import pandas as pd


def fetchRow(bucketName):
    data = pd.read_csv(r'D:\hm\hm_project\data\output1.csv', encoding='utf-8')
    if bucketName == 'wpsfile':
        data = pd.read_csv(r'D:\hm\hm_project\data\wpsfile.csv', encoding='utf-8')
    if bucketName == 'bytedance-beijing-ttvideo':
        data = pd.read_csv(r'D:\hm\hm_project\data\bytedance-beijing-ttvideo.csv', encoding='utf-8')
    if bucketName == 'video-yidian':
        data = pd.read_csv(r'D:\hm\hm_project\data\video-yidian.csv', encoding='utf-8')
    return data


def forecast(bucketName):
    data = pd.read_csv(r'D:\hm\hm_project\data\output1.csv', encoding='utf-8')
    if bucketName == 'wpsfile':
        data = pd.read_csv(r'D:\hm\hm_project\data\wpsfile_pred.csv', encoding='utf-8')
    if bucketName == 'bytedance-beijing-ttvideo':
        data = pd.read_csv(r'D:\hm\hm_project\data\bytedance-beijing-ttvideo_pred.csv', encoding='utf-8')
    if bucketName == 'video-yidian':
        data = pd.read_csv(r'D:\hm\hm_project\data\video-yidian_pred.csv', encoding='utf-8')
    return data


def health_fetchRow(bucketName):
    data = pd.read_csv(r'D:\hm\hm_project\data\file11.csv', encoding='utf-8')
    if bucketName == 'wpsfile':
        data = data.loc[:, ['date', 'wpsfiles']]
    if bucketName == 'bytedance-beijing-ttvideo':
        data = data.loc[:, ['date', 'bytedance-beijing-ttvideo']]
    if bucketName == 'video-yidian':
        data = data.loc[:, ['date', 'video-yidian']]
    data.columns = ['date', 'value']
    return data


def value_fetchRow(bucketName):
    data = pd.read_csv(r'D:\hm\hm_project\data\file22.csv', encoding='utf-8')

    if bucketName == 'wpsfile':
        data = data.loc[:, ['date', 'wpsfiles']]
    if bucketName == 'bytedance-beijing-ttvideo':
        data = data.loc[:, ['date', 'bytedance-beijing-ttvideo']]
        data['bytedance-beijing-ttvideo'] = data['bytedance-beijing-ttvideo']-0.4
    if bucketName == 'video-yidian':
        data = data.loc[:, ['date', 'video-yidian']]
    data.columns = ['date', 'value']
    data['value'] = data['value'] * 100
    return data


def health_forecast(bucketName):
    data = pd.read_csv(r'D:\hm\hm_project\data\file11_copy.csv', encoding='utf-8')
    if bucketName == 'wpsfile':
        data = data.loc[:, ['date', 'wpsfiles']]
    if bucketName == 'bytedance-beijing-ttvideo':
        data = data.loc[:, ['date', 'bytedance-beijing-ttvideo']]
    if bucketName == 'video-yidian':
        data = data.loc[:, ['date', 'video-yidian']]
    data.columns = ['date', 'value']
    return data


def value_forecast(bucketName):
    data = pd.read_csv(r'D:\hm\hm_project\data\file22_copy.csv', encoding='utf-8')
    if bucketName == 'wpsfile':
        data = data.loc[:, ['date', 'wpsfiles']]
    if bucketName == 'bytedance-beijing-ttvideo':
        data = data.loc[:, ['date', 'bytedance-beijing-ttvideo']]
    if bucketName == 'video-yidian':
        data = data.loc[:, ['date', 'video-yidian']]
    data.columns = ['date', 'value']
    return data


def erroratedata():
    data = pd.read_csv(r'D:\hm\hm_project\data\output1.csv', encoding='utf-8')
    data['date'] = pd.to_datetime(data['date'], format='%Y-%m-%d %H:%M:%S')
    return data


def forcastdata():
    data = pd.read_csv(r'D:\hm\hm_project\data\pred.csv', encoding='utf-8')
    return data


def provdata():
    data = pd.read_csv(r'D:\hm\hm_project\data\province.csv', encoding='utf-8')
    return data


def allData():
    data = pd.read_csv(r'D:\hm\hm_project\data\allDate.csv', encoding='utf-8')
    return data


def correlationdata(type):
    data = pd.DataFrame()
    if type == 'PUT':
        data = pd.read_csv(r'D:\hm\hm_project\data\corrPUT.csv', encoding='utf-8')
    if type == 'GET':
        data = pd.read_csv(r'D:\hm\hm_project\data\corrGET.csv', encoding='utf-8')
    if type == 'DELETE':
        data = pd.read_csv(r'D:\hm\hm_project\data\corrDELETE.csv', encoding='utf-8')
    return data
